<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>{$detail.name} - 帖子详情</title>
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        body {
            font-family: 'PingFang SC', 'Microsoft YaHei', sans-serif;
            line-height: 1.6;
            color: #333;
            padding: 15px;
            background-color: #f5f5f5;
        }

        .container {
            max-width: 800px;
            margin: 0 auto;
            background: #fff;
            border-radius: 8px;
            box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
            padding: 20px;
        }

        .post-header {
            padding: 20px;
            margin-bottom: 20px;
            border-bottom: 1px solid #eee;
            background: linear-gradient(135deg, #f6f9fc, #eef2f5);
        }

        .post-title {
            font-size: 20px;
            font-weight: bold;
            margin-bottom: 10px;
            color: #1a73e8;
        }

        .post-meta {
            display: flex;
            align-items: center;
            margin-bottom: 15px;
            font-size: 14px;
            color: #666;
        }

        .user-avatar {
            width: 40px;
            height: 40px;
            border-radius: 50%;
            margin-right: 10px;
        }

        .post-content {
            margin-bottom: 20px;
            line-height: 1.8;
        }

        .post-images {
            display: flex;
            flex-wrap: wrap;
            gap: 10px;
            margin-bottom: 20px;
        }

        .post-images img {
            max-width: 100px;
            max-height: 100px;
            border-radius: 4px;
        }

        .post-footer {
            display: flex;
            justify-content: space-between;
            font-size: 14px;
            color: #999;
            margin-bottom: 30px;
        }

        .comment-section {
            margin-top: 30px;
        }

        .comment-title {
            font-size: 18px;
            font-weight: bold;
            margin-bottom: 20px;
            padding-bottom: 10px;
            border-bottom: 1px solid #eee;
        }

        .comment-list {
            margin-bottom: 30px;
        }

        .comment-item {
            padding: 15px;
            margin-bottom: 15px;
            border-bottom: 1px solid #eee;
            border-left: 3px solid #1a73e8;
        }

        .comment-user {
            display: flex;
            align-items: center;
            margin-bottom: 10px;
        }

        .comment-content {
            margin-left: 50px;
            margin-bottom: 10px;
        }

        .comment-images {
            display: flex;
            flex-wrap: wrap;
            gap: 10px;
            margin-top: 10px;
        }

        .comment-images img {
            max-width: 100px;
            max-height: 100px;
            border-radius: 4px;
        }

        .comment-time {
            font-size: 12px;
            color: #999;
            margin-left: 50px;
        }

        .reply-list {
            margin-top: 15px;
            margin-left: 30px;
            background-color: #f9f9f9;
            padding: 10px;
            border-radius: 4px;
        }

        .reply-label {
            display: inline-block;
            background: #e6f4ea;
            color: #34a853;
            padding: 2px 8px;
            border-radius: 4px;
            font-size: 12px;
            margin-bottom: 8px;
        }

        .reply-item {
            padding: 10px 0;
            border-bottom: 1px dashed #ddd;
            border-left: 3px solid #34a853;
            background-color: #f8f9fa;
        }

        .reply-item:last-child {
            border-bottom: none;
        }

        .pagination {
            display: flex;
            justify-content: center;
            margin-top: 20px;
        }

        .pagination a {
            padding: 5px 10px;
            margin: 0 5px;
            border: 1px solid #ddd;
            border-radius: 4px;
            color: #333;
            text-decoration: none;
        }

        .pagination a:hover {
            background-color: #f0f0f0;
        }

        .pagination .active {
            background-color: #1E9FFF;
            color: #fff;
            border-color: #1E9FFF;
        }
    </style>
</head>

<body>
    <div class="container">
        <!-- 帖子详情 -->
        <div class="post-header">
            <h1 class="post-title">{$detail.name}</h1>
            <div class="post-meta">
                <img src="{$detail.user.avatar}" alt="头像" class="user-avatar">
                <span>{$detail.user.nickname}</span>
            </div>
            <div class="post-content">
                {$detail.content}
            </div>
            {if $detail.images}
            <div class="post-images">
                {foreach $detail.images as $image}
                <img src="{$image|cdnurl}" alt="帖子图片">
                {/foreach}
            </div>
            {/if}
        </div>

        <div class="post-footer">
            <span>发布时间：{$detail.createtime|date='Y-m-d H:i:s',###}</span>
            <span>地区：{$detail.address}</span>
        </div>

        <!-- 联系方式 -->
        <div class="contact-info"
            style="margin-bottom: 30px; padding: 15px; background-color: #f9f9f9; border-radius: 4px;">
            <h3 style="margin-bottom: 10px; font-size: 16px;">联系方式</h3>
            <p style="margin-bottom: 5px;">电话：{$detail.mobile}</p>
            {if $detail.wx_image}
            <p style="margin-bottom: 5px;">微信：<img src="{$detail.wx_image|cdnurl}" alt="微信二维码"
                    style="width: 100px; height: 100px;"></p>
            {/if}
        </div>

        <!-- 评论区域 -->
        <div class="comment-section">
            <h3 class="comment-title">评论 ({$comments->total()})</h3>

            <div class="comment-list">
                {volist name="comments" id="comment"}
                <div class="comment-item">
                    <div class="comment-user">
                        <img src="{$comment.userinfo.avatar}" alt="用户头像" class="user-avatar">
                        <span>{$comment.userinfo.nickname}</span>
                    </div>
                    <div class="comment-content">
                        {$comment.content}
                    </div>

                    {if $comment.images}
                    <div class="comment-images">
                        {foreach $comment.images as $image}
                        <img src="{$image}" alt="评论图片">
                        {/foreach}
                    </div>
                    {/if}

                    <div class="comment-time">
                        {$comment.createtime_text}
                    </div>

                    <!-- 回复列表 -->
                    {if $comment.child}
                    <div class="reply-list">
                        {foreach $comment.child as $reply}
                        <div class="reply-item">
                            <span class="reply-label">回复</span>
                            <div class="comment-user">
                                <img src="{$reply.userinfo.avatar}" alt="用户头像" class="user-avatar">
                                <span>{$reply.userinfo.nickname}</span>
                            </div>
                            <div class="comment-content">
                                {$reply.content}
                            </div>

                            {if $reply.images}
                            <div class="comment-images">
                                {foreach $reply.images as $image}
                                <img src="{$image}" alt="回复图片">
                                {/foreach}
                            </div>
                            {/if}

                            <div class="comment-time">
                                {$reply.createtime_text}
                            </div>
                        </div>
                        {/foreach}
                    </div>
                    {/if}
                </div>
                {/volist}
            </div>

            <!-- 分页 -->
            <div class="pagination">
                {$comments->render()}
            </div>
        </div>
    </div>
</body>

</html>